import time
import functools

# 使用普通函数装饰
def my_decorator(func):
    # 保持原函数的元信息
    @functools.wraps(func)
    def wrapper(*args,**kwargs):
        print("wrapper函数开始")
        start_time = time.perf_counter()
        func(*args,**kwargs)
        end_time = time.perf_counter()
        print(f"函数执行时间为：{end_time-start_time}")
        print("wrapper函数结束")
    return wrapper

# *args是元组类型 **kwargs是字典类型
@my_decorator
def welcome(*args,**kwargs):
    name,gender = args
    gender = "男士" if gender =='男' else '女士'
    print(f"hi,{name}{gender},welcome")
    print(f"{name}的年龄为：{kwargs['age']}，爱好为：{kwargs['hobby']}")

welcome('小明','男',age=18,hobby='basketball')
print(welcome.__name__)